package Creational_design_pattern.Prototype_Pattern.Shallow_Clone;

public class Email implements Cloneable{
    private Attachment attachment = null;

    public Email() {
        this.attachment = new Attachment();
    }
    public Object clone(){
        Email clone = null;
        try {
            clone = (Email) super.clone();
        }
        catch (CloneNotSupportedException e) {
            System.out.println("克隆失败");
        }
        return clone;
    }

    public void display(){
        System.out.println("查看邮件");
    }

    public Attachment getAttachment() {
        return attachment;
    }
}
